//
//  ViewController.m
//  16-UICollectionViewImage
//
//  Created by dllo on 16/8/4.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "ViewController.h"
#import "PFCycleImages.h"
@interface ViewController () <PFCycleImagesDataSource>
@property (weak, nonatomic) IBOutlet PFCycleImages *cycleImage;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
//    PFCycleImages *cycle = [[PFCycleImages alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 200)];
//    [self.view addSubview:cycle];
//    NSArray *pathArray = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    
    
    NSMutableArray *array = [NSMutableArray array];
    NSMutableArray *strArray = [NSMutableArray array];
    for (int i = 0; i < 5; i++) {
        [array addObject:[NSString stringWithFormat:@"%d.jpg", i]];
        [strArray addObject:[NSString stringWithFormat:@"第%d张图片", i]];
    }
   
    NSString *firstImage = [array firstObject];
    NSString *lastImage = [array lastObject];
    [array insertObject:lastImage atIndex:0];
    [array addObject:firstImage];
     _cycleImage.array = array;
    _cycleImage.titleArray = strArray;
    
    _cycleImage.dataSource = self;
}
- (void)handleDataWithObject:(id)objc cell:(__kindof UICollectionViewCell *)cell {
    NSString *imageName = objc;
    PFCycleImagesCell *imageCell = cell;
   imageCell.cycleImage.image = [UIImage imageNamed:imageName];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
